var TimistemiAssistant = Class.create(AbstractModule, {


setupWidgets: function() {

		//About
		this.controller.setupWidget(Mojo.Menu.appMenu, {
			omitDefaultItems: true
		}, {
			visible: true,
			items: [
      		Mojo.Menu.editItem,
			{ label: "Disclaimer", command: "do-disclaimer" },					
				{ label: "License", command: "do-license" },
				{ label: "Help", command: "do-help" }
			]
		});

this.help = true;

  
	
	this.controller.setupWidget("age", {
			label: "Age (yrs)",
			choices: [
				{ label: "< 65 ", value: 0},
				{ label: "65-74", value: 2},
				{ label: "&ge; 75", value: 3}				
			]
		}, this.ageModel = {
			value: 0
		});
	
	
	
	this.toggleModel = {
			dmCHK: false
			};
	this.toggleModel = {
		sbpCHK: false
			};
	this.toggleModel = {
			hrCHK: false
			};
			
	this.toggleModel = {
			killipCHK: false
			};						
	this.toggleModel = {
			weightCHK: false
			};
			
	this.toggleModel = {
			antstCHK: false
			};
			
	this.toggleModel = {
			timeCHK:false		
			};									

			
	this.controller.setupWidget("dmCHK", {
			modelProperty: "dmCHK"
		}, this.toggleModel);

	this.controller.setupWidget("sbpCHK", {
			modelProperty: "sbpCHK"
		}, this.toggleModel);

	this.controller.setupWidget("hrCHK", {
			modelProperty: "hrCHK"
		}, this.toggleModel);

	this.controller.setupWidget("killipCHK", {
			modelProperty: "killipCHK"
		}, this.toggleModel);
		
	this.controller.setupWidget("weightCHK", {
			modelProperty: "weightCHK"
		}, this.toggleModel);
	this.controller.setupWidget("antstCHK", {
			modelProperty: "antstCHK"
		}, this.toggleModel);
	this.controller.setupWidget("timeCHK", {
			modelProperty: "timeCHK"
		}, this.toggleModel);
	
},



	calculate: function() {
	var result = timistemicalc(parseInt(this.ageModel.value),this.toggleModel.dmCHK,this.toggleModel.sbpCHK,this.toggleModel.hrCHK,this.toggleModel.killipCHK,this.toggleModel.weightCHK,this.toggleModel.antstCHK,this.toggleModel.timeCHK);
 
	return "The TIMI score is " + result.timiscore + " which represents " + result.mortality;
	}
});





